<div class="boxed">
    <div id="content-container">
        <div id="page-title">
            <h1 class="page-header text-overflow">Data Tables</h1>
            <div class="searchbox">
                <div class="input-group custom-search-form">
                    <input type="text" class="form-control" placeholder="Search..">
                    <span class="input-group-btn">
                        <button class="text-muted" type="button"><i class="demo-pli-magnifi-glass"></i></button>
                    </span>
                </div>
            </div>
        </div>
        <ol class="breadcrumb">
            <li><a href="{:url('Admin/Index/index')}">首页</a></li>
            <li>系统设置</li>
            <li class="active">数据还原</li>
        </ol>
        <div id="page-content">
            <div class="widget">
                <div class="row">
                    <div class="col-xs-12">
                        <!-- PAGE CONTENT BEGINS -->
                        <form id="export-form" method="post" action="{:url('export')}">
                            <table class="table table-striped table-bordered">
                                <thead>
                                <tr>
                                    <th width="5">
                                        <input class="check-all" checked="chedked" type="checkbox" value="">
                                    </th>
                                    <th width="100">备份名</th>
                                    <th width="100">数据大小</th>
                                    <th width="100">创建时间</th>
                                    <th width="100">操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                {volist name="list" id="table"}
                                <tr>
                                    <td class="num">
                                        <input class="ids" checked="chedked" type="checkbox" name="tables[]"
                                               value="{$table.name}">
                                    </td>
                                    <td>{$table.name}</td>
                                    <td>{$table.info}kb</td>
                                    <td>{$table.filetime}</td>
                                    <td class="action">
                                        <a onclick="database.resore('{$table.name}')" class="btn btn-info">数据还原</a>
                                        <a onclick="database.del('{$table.name}')" class="btn btn-danger">数据删除</a>
                                    </td>
                                </tr>
                                {/volist}
                                </tbody>
                            </table>
                        </form>
                        <!-- PAGE CONTENT ENDS -->
                    </div><!-- /.col -->
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    var database = {
        resore:function ($name) {
            layer.confirm('您确定要还原数据库信息吗？还原以后,如果您是一周前备份的数据,那将丢失本周所有数据,除非系统出错,否则请勿轻易进行还原,你可明白？', {
                btn: ['死心塌地要还原','刚手抖了'] //按钮
            }, function(){
                layer.msg('还原中...',{time:2000},function () {
                    $.post('{:url("Admin/Database/restore")}', {name:$name}, function(data, textStatus, xhr) {
                        layer.alert(data)
                    });
                })
            }, function(){

            });
        },
        del:function () {
            layer.confirm('确定要删除此备份吗？删除后,如果数据出错,将无法再还原数据哦~', {
                btn: ['我要删除','手抖了'] //按钮
            }, function(){
                layer.msg('假装删除成功', {icon: 1});
            }, function(){
                layer.msg('也可以这样');
            });
        }
    }
</script>